package tools;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import com.sun.imageio.plugins.common.InputStreamAdapter;

/**
 *
 * @author dimitri
 */
public class FileManager {
    private File file;
    private FileInputStream fileInputStream;    
    private byte[] byteArray;
    private ByteArrayInputStream byteArrayInputStream;
    
    public FileManager(String path) throws FileNotFoundException, IOException {
        this.file = new File(path);
        this.fileInputStream = new FileInputStream(this.file);
        
        this.byteArray = new byte[(int) this.file.length()];
        this.fileInputStream.read(this.byteArray);       
       
        
        this.byteArrayInputStream = new ByteArrayInputStream(this.byteArray);
    }

     public FileManager(File f) throws FileNotFoundException, IOException {
        this.file = f;
        this.fileInputStream = new FileInputStream(this.file);

        this.byteArray = new byte[(int) this.file.length()];
        this.fileInputStream.read(this.byteArray);


        this.byteArrayInputStream = new ByteArrayInputStream(this.byteArray);
    }

    public byte[] getByteArray() {
        return this.byteArray;
    }
    
    public ByteArrayInputStream getByteArrayInputStream() {
        return this.byteArrayInputStream;
    }
    
    public File getFile() {
        return this.file;
    }

    public FileInputStream getFileInputStream() {
        return this.fileInputStream;
    }
            
            
}
